//
//  FileList_Cell.m
//  ICE_Player
//
//  Created by xl on 11-7-25.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "FileList_Cell.h"
#import "Globalize.h"
#import "BGView.h"
#include "ICE_global_var.h"

@implementation FileList_Cell

@synthesize bg_view;
@synthesize file_icon;
@synthesize play_btn;
@synthesize file_name;
@synthesize play_label;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code.
    }
    play_label.text = IGS(EG_STR_ID_LIST_CELL_PLAY);
    return self;
}

// Frame is ignored.  The size will be specified by the table view width and row height.
- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code.
    }
    play_label.text = IGS(EG_STR_ID_LIST_CELL_PLAY);
    return self;
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state.
}


- (void)dealloc {
	[self destroy_SubViews];
    [super dealloc];
}

- (void)create_SubViews:(UIViewController*)controller
{
    [super create_SubViews:controller];
}

- (void)destroy_SubViews
{
}

- (IBAction)On_Click_Play_Btn:(id)sender
{
    BGView* bg_v = [BGView get_Last_BG_view];
    char url[MAX_ICE_URL_LEN] = {0};
    if (bg_v)
    {
        [NSHomeDirectory() getCString:url];
        strcat(url, FILE_FOLDER);
        [file_name.text getCString:(&url[strlen(url)]) maxLength:(MAX_ICE_URL_LEN - strlen(url)) encoding:NSUTF8StringEncoding];
        //[file_name.text getCString:(&url[strlen(url)])];
        [bg_v On_Call_Player_View:url];
    }
}

- (IBAction)On_Selected_Cell:(id)sender
{
    BGView* bg_v = [BGView get_Last_BG_view];
    if (bg_v)
    {
        [bg_v On_Selected_A_List_Cell];
    }
}

- (IBAction)On_Deselected_Cell:(id)sender
{
    BGView* bg_v = [BGView get_Last_BG_view];
    if (bg_v)
    {
        //[bg_v On_Selected_A_List_Cell];
    }
}

@end
